<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>门票预定</title>
    <style>
        body {
            max-width: 393px;
            margin: 0 auto;
            font-family: Arial, sans-serif;
            background-color:  #f4f4f4;
            color: #333;
        }
        .container {
            width: 393px;
            height: auto; /* 容器高度自适应 */
            max-width: 100%;
            padding: 10px;
            box-sizing: border-box;
            background-color: #fff;
            border: 1px solid #ddd;
            border-radius: 8px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
            display: flex;
            flex-direction: column;
            overflow-y: auto; /* 超出部分显示滚动条 */
        }

        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px;
            background-color: #ddd;
            border-bottom: 1px solid #ddd;
        }
        .header h1 {
            font-size: 18px;
            margin: 0;
            text-align: left; /* 标题左对齐 */
            flex-grow: 1; /* 确保标题占据剩余空间 */
        }
        .header button {
            padding: 8px 12px;
            border: none;
            background-color: #c1bebe;
            color: black;
            border-radius: 4px;
            cursor: pointer;
            font-size: 14px;
        }
        .header button:hover {
            background-color: #0056b3;
        }

        .spot {
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            margin-bottom: 15px;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
            min-height: 200px; /* 每个景点项的最小高度 */
        }

        .spot img {
            width: 100%;
            height: 150px;
            object-fit: cover;
        }

        .spot .details {
            padding: 10px;
            flex-grow: 1; /* 让详情部分占满剩余空间 */
        }

        .spot .details .name {
            font-size: 16px;
            font-weight: bold;
            margin-bottom: 10px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap; /* 防止文本溢出 */
        }

        .buttons {
            display: flex;
            justify-content: center;
            gap: 10px;
            margin-top: 10px;
        }

        .ticket-button {
            padding: 8px 16px;
            font-size: 14px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            background-color: #007bff;
            color: white;
        }

        .ticket-button:hover {
            background-color: #0056b3;
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <header class="header">
        <h1>团票预定</h1>
        <button onclick="window.location.href='/home'">返回</button>
    </header>
    <div class="container">
        {% for spot in spots %}
        <div class="spot">
            <img src="{{ url_for('static', filename='images/' + spot.image_url) }}" alt="景区图片">
            <div class="details">
                <div class="name">{{ spot.name }}</div>
                <div class="buttons">
                    <!-- 跳转到预约页面 -->
                    <button class="ticket-button" onclick="window.location.href='/group_sure/{{ spot.id }}'">预约</button>
                </div>
            </div>
        </div>
        {% endfor %}
    </div>
</body>
</html>
